<script type="text/javascript">
    set_document_title("<?php echo $article->title;?>");
</script>
<div id="post-view" class="post-wrapper">
    <div class="post-top">
        <div class="pv-title">
            <a href="<?php echo base_url() . 'main/view/' . $article->article_id . '/' . url_title($article->title); ?>">
                <?php echo $article->title; ?>
            </a>
        </div>
        <div class="pv-image">
            <div class="main-image">
                <?php
                $first = $image->first_row();
                $this->config->load('upload');
                $url = base_url() . substr($this->config->item('upload_path'), 2);
                $width = $first->image_width;
                if ($width > 600) {
                    $width = 600;
                }
                ?>
                <img onclick="img_preview(this,0)" style="width:<?php echo $width; ?>px" src="<?php echo $url . $first->image_url; ?>" alt=""/>
            </div>
        </div>
            <div style="<?php echo ($image->num_rows <= 1) ? 'display:none' : ''; ?>" class="pv-gallery">
                <?php
                $count = 0;
                foreach ($image->result() as $row) {
                    ?>
                    <img onclick="img_preview(this,<?php echo $count; ?>)" id="pv-gallery-thumb-<?php echo $count++; ?>" class="pv-gallery-thumb" src="<?php echo $url . $row->image_url; ?>" alt="" style="width:100px;"/>
                    <?php
                }
                ?>
            </div>
        <script type="text/javascript">
            var total_image = <?php echo $count; ?>;
        </script>
        <div class="pv-content">
            <?php echo $article->content; ?>
        </div>
    </div>
    <div class="post-bottom">
        <div class="post-utility">
            <div class="post-meta">
                <p>Posted in  <a><?php echo $article->category_name; ?></a> By <?php echo $article->name; ?> At <?php echo $article->post_date; ?></p>
            </div>
        </div>                        
    </div>
</div>